home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / football / exec / alt_results.rexx < prev    next >
OS/2 REXX Batch file  |  1999-11-29  |  7KB  |  239 lines

  1. /* ***********************************************************************
  2.  
  3.    RESULTS PROGRAM FOR FOOTBALL REXX SUITE
  4.   ---------------------------------------
  5.                    Copyright  Mark Naughton 1996
  6.  
  7.  
  8. Version    Date     History
  9. --------------------------------------------------------------------------
  10.  1.0       270996   First release. Displays all results from 'Teams.sf'
  11.                     file.
  12.  1.1       121196   Updated to get arguments and to use '*.sflearn' to get
  13.                     a true display as '.sf' was in order. Now called as a
  14.                     component of FOOTBALL.
  15.            131196   Added checks for files - if not found, exits without
  16.                     a message.
  17.            211196   Updated and tidied the display.
  18.            190497   Added title to display.
  19.  1.2       060997   Amended to handle new Automatic Scheduling schedules.
  20.                     Removed - new program for this. Formatting needs to be
  21.                     handled properly.
  22.            151297   Tidied display.
  23.            180499   Improved match/fixture display.
  24.            310599   Changed to accommodate extra data in '.sflearn' file.
  25.  1.3       280699   Added and changed code to run the same as the alternative
  26.                     displays for League, to display goal scorers, bookings,
  27.                     substitutes, referees and attendances.
  28.            250899   Added error msg to file check.
  29.            270899   Converted to use locale. Some error messages, before
  30.                     reading the locale, will still be in English.
  31.            290899   Added support for Yellow-then-Red cards.
  32.  
  33. **************************************************************************
  34.  
  35. Procedure
  36. ---------
  37.  
  38. 1. Check files exist.
  39. 2. Open file and print all lines without '*' with the exception of
  40.    the league name which is underlined. Build table of player information
  41.    and match information then display.
  42. 3. Close file and exit.
  43.  
  44. ************************************************************************** */
  45. PARSE ARG league_file
  46.  
  47. version     = 1
  48. league_file = "Data/" || league_file
  49. input_file  = '.sflearn'
  50. separator   = '*'
  51. separator2  = '**'
  52. home.       = '???'
  53. hct         = 0
  54. away.       = '???'
  55. act         = 0
  56. hmkr        = -1
  57. amkr        = -1
  58.  
  59.  
  60. if open(datafile,"Data/Football.locale",'r') then do
  61.    line = readln(datafile)
  62.    locdir = strip(line)
  63.    close(datafile)
  64. end
  65. else do
  66.    say
  67.    say "ERROR :    (Results)"
  68.    say
  69.    say "Cannot read 'Data/Football.locale' for the locale settings."
  70.    exit
  71. end
  72.  
  73. locdir = locdir"Exec/Alt_Results.data"
  74.  
  75. if open(datafile,"ENV:FootballRXPath",'r') then do
  76.    line = readln(datafile)
  77.    rxdir = strip(line)
  78.    close(datafile)
  79. end
  80. else
  81.    rxdir = "SYS:Rexxc/"
  82.  
  83. if exists(locdir) > 0 then do
  84.   address command rxdir'rx 'locdir
  85.   VarCount = getclip('VarCount')
  86.   do i = 1 to VarCount
  87.     interpret getclip('var.'i)
  88.   end
  89. end
  90. else do
  91.    say
  92.    say "ERROR :    (Results)"
  93.    say
  94.    say "Cannot find '"locdir"' to read locale settings."
  95.    exit
  96. end
  97.  
  98. if exists(league_file || input_file) = 0 then do
  99.    say
  100.    say ar_error
  101.    say
  102.    say ar_one"'"league_file||input_file"'."
  103.    exit
  104. end
  105.  
  106. spaces = left(" ",30,' ')
  107. do i=1 to 99
  108.    home.i = spaces
  109.    away.i = spaces
  110. end
  111. referee = ""
  112. attend  = ""
  113.  
  114. if open(datafile,league_file || input_file,'r') then do
  115.    say
  116.    say center(ar_two,78)
  117.    say "-------------------------------------------------------------------------------"
  118.    say
  119.    do while ~eof(datafile)
  120.       line = readln(datafile)
  121.       if pos(separator,line) = 0 then do
  122.          if act = 0 & hct = 0 then do
  123.             say
  124.             say
  125.             say
  126.          end
  127.          if act > 0 | hct > 0 then do
  128.             if hct > act then
  129.                mloop = hct
  130.             else
  131.                mloop = act
  132.             say
  133.             do ii=1 to mloop
  134.                t2 = home.ii
  135.                t3 = away.ii
  136.                say left(strip(t2),30,' ')"          "left(strip(t3),30,' ')
  137.                home.ii = spaces
  138.                away.ii = spaces
  139.             end
  140.             say
  141.             if referee ~= "" then
  142.                say ar_three""referee
  143.             if attend ~= "" then
  144.                say ar_four""attend
  145.             referee = ""
  146.             attend  = ""
  147.             say
  148.             say
  149.             say
  150.             act = 0
  151.             hct = 0
  152.          end
  153.          say line
  154.       end
  155.       else do
  156.          if pos(separator2,line) > 0 then do
  157.             say subword(line,2)
  158.             uline = ''
  159.             do i=1 to length(subword(line,2))
  160.                uline = insert('-',uline,i,1)
  161.             end
  162.             say strip(uline)
  163.             say
  164.          end
  165.          else do
  166.             if pos("*ATD=",line) > 0 then
  167.                attend = delstr(line,1,5)
  168.             if pos("*RF=",line) > 0 then
  169.                referee = delstr(line,1,4)
  170.             if pos("*HG=",line) > 0 then do
  171.                hct = hct + 1
  172.                home.hct = delstr(line,1,4)
  173.                if pos("(P)",home.hct) > 0 then do
  174.                   lk = pos("(P)",home.hct)
  175.                   home.hct = overlay("(pen)",home.hct,lk,5)
  176.                end
  177.             end
  178.             if pos("*AG=",line) > 0 then do
  179.                act = act + 1
  180.                away.act = delstr(line,1,4)
  181.                if pos("(P)",away.act) > 0 then do
  182.                   lk = pos("(P)",away.act)
  183.                   away.act = overlay("(pen)",away.act,lk,5)
  184.                end
  185.             end
  186.             if pos("*HY=",line) > 0 then do
  187.                hct = hct + 1
  188.                home.hct = delstr(line,1,4)" "ar_five
  189.             end
  190.             if pos("*AY=",line) > 0 then do
  191.                act = act + 1
  192.                away.act = delstr(line,1,4)" "ar_five
  193.             end
  194.             if pos("*HYR=",line) > 0 then do
  195.                hct = hct + 1
  196.                home.hct = delstr(line,1,5)" "ar_six
  197.             end
  198.             if pos("*AYR=",line) > 0 then do
  199.                act = act + 1
  200.                away.act = delstr(line,1,5)" "ar_six
  201.             end
  202.             if pos("*HR=",line) > 0 then do
  203.                hct = hct + 1
  204.                home.hct = delstr(line,1,4)" "ar_seven
  205.             end
  206.             if pos("*AR=",line) > 0 then do
  207.                act = act + 1
  208.                away.act = delstr(line,1,4)" "ar_seven
  209.             end
  210.             if pos("*HS=",line) > 0 then do
  211.                hct = hct + 1
  212.                home.hct = delstr(line,1,4)" "ar_eight
  213.             end
  214.             if pos("*AS=",line) > 0 then do
  215.                act = act + 1
  216.                away.act = delstr(line,1,4)" "ar_eight
  217.             end
  218.             if pos("*HM=",line) > 0 then do
  219.                hct = hct + 1
  220.                home.hct = ar_nine""delstr(line,1,4)
  221.             end
  222.             if pos("*AM=",line) > 0 then do
  223.                act = act + 1
  224.                away.act = ar_nine""delstr(line,1,4)
  225.             end
  226.          end
  227.       end
  228.    end
  229.    say "-------------------------------------------------------------------------------"
  230.    close(datafile)
  231. end
  232. else do
  233.    say
  234.    say "ERROR :    (Results)"
  235.    say
  236.    say ar_ten"'"league_file||input_file"'"ar_eleven
  237. end
  238.  
  239. exit